home *** CD-ROM | disk | FTP | other *** search
/ Scene Storm / Scene Storm - Volume 1.iso / coding / c / amiexpress / source / ae / code / ax3.00 / yesno.c < prev    next >
Encoding:
C/C++ Source or Header  |  1980-01-03  |  571 b   |  30 lines

  1. #include "bbs.h"
  2.  
  3. int YesNo(UWORD flag)
  4. {
  5. int ch;
  6.  
  7.  if(flag) {
  8.      ch=flag-1;
  9. //     AEPutStr((ch?"(y/N)?)
  10.      AEPutStr((ch?"(y/N)? ":"(Y/n)? "));
  11.  }
  12.  
  13.  for(;;) {
  14.      ch=ReadChar(KEYBOARD_TIMEOUT);
  15.      if(ch<0) return(ch);
  16.      if(ch=='\r'||ch=='\n') {
  17.          if(flag==1)     ch='y';
  18.          if(flag==2)     ch='n';
  19.      }
  20.      if(ch=='y'||ch=='Y') {
  21.          AEPutStr("Yes\r\n");
  22.          return(1);
  23.      }
  24.      if(ch=='n'||ch=='N') {
  25.          AEPutStr("No\r\n");
  26.          return(0);
  27.      }
  28.  }
  29. }
  30.